import { MigrationInterface, QueryRunner } from "typeorm";

export class Bbb1722696683082 implements MigrationInterface {
    name = 'Bbb1722696683082'

    public async up(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`CREATE TABLE \`job\` (\`id\` int NOT NULL AUTO_INCREMENT, \`name\` varchar(255) NOT NULL, \`desc\` varchar(255) NOT NULL, \`userIdId\` int NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
        await queryRunner.query(`ALTER TABLE \`job\` ADD CONSTRAINT \`FK_86977eaae912a26e278ccba0271\` FOREIGN KEY (\`userIdId\`) REFERENCES \`user\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
    }

    public async down(queryRunner: QueryRunner): Promise<void> {
        await queryRunner.query(`ALTER TABLE \`job\` DROP FOREIGN KEY \`FK_86977eaae912a26e278ccba0271\``);
        await queryRunner.query(`DROP TABLE \`job\``);
    }

}
